fix(ptodsl): correct With slot liveness - #1340
Conversation
3b5bbc9 to
87c8f9a
Compare
mouliangyu
left a comment
There was a problem hiding this comment.
发现两个需要在合入前处理的问题:GS8 的普通 vlds 会把 compact load 的实际读取范围扩大到完整 vector footprint;With/AsyncWith 的 slot liveness 对多 context item 的绑定顺序处理不正确。
验证:LLVM 19.1.7 下重建 pto-test-opt 成功,11 个受影响的 VMI lit 用例通过;新增 PTODSL probe 可单独生成两个 scf.for。现有测试主要验证 IR 形态,未覆盖下面的内存边界和多 item with 场景。
|
|
||
|
|
||
| def _slot_live_before_stmt(stmt, live_after, static_env, static_iters) -> set[_SubscriptSlot]: | ||
| if isinstance(stmt, (ast.With, ast.AsyncWith)): |
There was a problem hiding this comment.
这里没有遵循 Python with item 从左到右求值、每项立即绑定 optional_vars 的语义。例如 with cm() as values, cm(values[0]): pass 中,第二项的 values[0] 不是 with 之前的 live-in,但当前实现会把它加入 context_loads,纯 AST probe 也确实返回该 slot。这可能生成未定义或多余的 loop carry。建议从 body_live 开始逆序遍历 items:先 kill 当前 optional_vars 的绑定,再加入该项 context_expr 的 loads,并覆盖 subscript 绑定目标。
309ad3d to
d112ac0
Compare
d112ac0 to
86b7744
Compare
mouliangyu
left a comment
There was a problem hiding this comment.
复审通过。先前两条阻塞意见均已处理:GS8/VMI 改动已移除;With/AsyncWith 的 slot liveness 已按 with-item 的求值与绑定顺序修正,并补充了聚焦回归测试。CI 全绿。
A3 板测失败
失败用例
|
Summary
This PR keeps the two changes from
tilekernels-vmi-perfthat are still in scope, rebased onto the currentmain:With/AsyncWithstatements, with regression coverage.The previously included fp8/f16 deinterleaved cast-layout commit has been removed because that issue is being handled separately. No byte-widening vgather changes are included; those overlap with PTOAS PR #1315.
Validation
ninja -C build pto-test-optllvm-lit -v build/test/lit/vmi_new/vmi_to_vpto_group_slot_load.pto— PASSPYTHONPATH=build/python:$PYTHONPATH .venv/bin/python ptodsl/tests/test_jit_compile.py— PASSllvm-lit -q build/test/lit/vmi_new— 514/526 passed; 12 remaining failures are in existing group-slot/optimization paths.